<template>

	<view class="main">
		<u-navbar :fixed="false" title="我的影像" @rightClick="rightClick" :autoBack="true"></u-navbar>

		<view class="bit">
			<!-- <view class="row_a_c but space-between">
				<view class="time">
					全部病历
				</view>
				<view>
					<image class="xltb" src="/static/images/xltb.png"></image>
				</view>
			</view> -->

			<view class="tabs">
				<view class="tab-item" :class="{ active: type ==2 }" @click="switchTab(2)">今日</view>
				<view class="tab-item" :class="{ active: type == 1 }" @click="switchTab(1)">全部</view>
			</view>
		</view>






		<z-paging ref="paging" v-model="MedicaRecordlListData" @query="queryList" usePageScroll>
			<view class=" column_c">

				<view class="card-content" v-for="(item, index) in MedicaRecordlListData" :key="index">

					<view @click="toUrl(item.id)">
						<view class="row_a_c space-between">
							<text class="clinic">{{item.created_at}} | {{item.territory.name}}</text>
							<text class="status success center" v-if="item.type==1">初诊病历</text>
							<text class="status success center" v-if="item.type==2">复诊病历</text>
						</view>
						<view class="appointment-info">
							<view class="name">医生：{{item.doctor.name}}</view>
							<view class="time">诊断：{{item.diagnosis}}</view>
							<view class="time">处置：{{item.treatment}}</view>
						</view>
					</view>

				</view>

			</view>

		</z-paging>



	</view>

</template>

<script>
	import api_screenage from '@/api/screenage.js';
	import ZPMixin from '@/uni_modules/z-paging/components/z-paging/js/z-paging-mixin';

	export default {

		mixins: [ZPMixin],
		async onShow() {
			// this.getMedicaRecordlListFuc(); //获取病历列表
		},

		data() {
			return {
				type: 1, //查询类型 1全部 2今天
				MedicaRecordlListData: [],
			};
		},

		methods: {

			switchTab(tab) {
				this.type = tab;
				this.$refs.paging.reload();

			},
			async queryList(pageNo, pageSize) {

				const per = {
					no_page: pageNo,
					page_size: pageSize,
					type: this.type,
				}

				const res = await api_screenage.getScreenageList(per);
				if (res.code == 1) {
					this.$refs.paging.complete(res.data.list);
				} else {
					this.$refs.paging.complete(false);
				}

			},



			//获取病历列表
			// async getMedicaRecordlListFuc() {
			// 	var per = {
			// 		no_page: 1,
			// 		page_size: 10,
			// 		type: 1,
			// 	}
			// 	const res = await api_history.getMedicaRecordlList(per);
			// 	if (res.code == 1) {
			// 		this.MedicaRecordlListData = res.data.list
			// 	} else {
			// 		this.$util.msg(res.message);
			// 		return;
			// 	}
			// },

			toUrl(id) {
				uni.navigateTo({
					url: `/pages/zxhd/wdyx?id=${id}`
				});
			},

		}
	};
</script>

<style scoped lang="scss">
	.main {
		background: #FAFAFA;
		height: 100vh;

		// padding: 32rpx;
	}

	.bit {
		padding: 32rpx;
	}

	.but {

		width: 290rpx;
		height: 60rpx;
		background: #FFFFFF;
		border-radius: 50rpx 50rpx 50rpx 50rpx;
		padding: 0 30rpx;
	}

	.time {
		font-weight: 400;
		font-size: 28rpx;
		color: #7F7F7F;
	}

	.xltb {
		width: 32rpx;
		height: 32rpx;
	}


	.container {
		padding: 0;
	}

	.card {
		background-color: #fff;
		border-radius: 8px;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
		margin-bottom: 20px;
	}

	.card-header {
		display: flex;
		justify-content: space-between;
		padding: 10px;
		border-bottom: 1px solid #f0f0f0;
	}

	.status {


		font-weight: 400;
		font-size: 20rpx;
		color: #27CCBB;

	}


	.cancelled {
		color: #f44336;
	}

	.card-content {
		width: 686rpx;
		min-height: 250rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 8rpx -2rpx rgba(0, 0, 0, 0.04), 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.03), 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.02);
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		padding: 32rpx;
		margin-bottom: 20rpx;
	}

	.clinic {
		font-weight: bold;
		font-size: 28rpx;
		color: rgba(0, 0, 0, 0.85);


	}

	.name {

		font-weight: 400;
		font-size: 24rpx;
		color: rgba(0, 0, 0, 0.6);
		margin-bottom: 12rpx;

	}

	.time {

		font-weight: 400;
		font-size: 24rpx;
		color: rgba(0, 0, 0, 0.6);
		margin-bottom: 12rpx;


	}



	.appointment-info {
		margin-top: 20rpx;
	}

	.tabs {
		display: flex;
		justify-content: flex-start;
		margin: 20rpx 0;
		border-bottom: 2rpx solid #f0f0f0;
	}

	.tab-item {
		margin-right: 40rpx;
		padding-bottom: 10rpx;
		font-size: 32rpx;
		color: rgba(0, 0, 0, 0.95);
		font-weight: 500;
	}

	.tab-item.active {
		color: #2dc6a4;
		border-bottom: 2rpx solid #2dc6a4;
	}
</style>